<%@ include file="../system/HeaderStrutsForm.jsp" %>
<html>
  <head>
    <title>
      <bean:message key="page.title"/>
    </title>
    <bean:message key="page.css"/>
    <bean:message key="page.script"/>
  </head>
  <center>
    <body>
      <table class="mainTable" style='width:500;'>
        <tr>
          <td>
            <table class="headerTable">
              <tr>
                <td class='td10'>
                  <bean:message key="page.title"/>
                </td>
              </td>
            </tr>
          </table>
          <%
          {
            %>
            <form class="baseForm" >
              <table class="bannerTable" style=width:500;>
                <tr>
                  <td class="tableHeader">
                    Lista de Processadores
                  </td>
                </tr>
              </table>
              <table id="TRbl_report_Processador" class="reportTable" style=width:500;  >
                <%
                int counterbl_report_Processador=0;
                %>
                <%
                {
                  br.com.werp.suporte.dbobj.table.Processador t_processador = new br.com.werp.suporte.dbobj.table.Processador();
                  java.util.Vector res_Processador = null;
                  com.egen.util.jdbc.JdbcUtil j = null;
                  try {
                    j = new com.egen.util.jdbc.JdbcUtil();
                    String[][] select =  null;
                    Object[][] where = null;
                    String[] groupby =  null;
                    String[] having =  null;
                    String[] order = {};
                    res_Processador = j.select(t_processador,select,where,groupby,having,order);
                  } catch (Exception e){
                    session.setAttribute("exception",com.egen.util.system.Error.getDescription(e));
                    %>
                    <jsp:forward page="/system/ErrorPage.jsp"/>
                    <%
                  } finally {
                  if(j!=null){j.close();}
                }
                if (res_Processador!=null && res_Processador.size()>0) {
                  if ( ((String)request.getParameter("_ordered"))!=null && ((String)request.getParameter("_ordered")).length()>0 ) {
                    boolean reverse = false;
                    if ( ((String)request.getParameter("_reverse"))!=null && ((String)request.getParameter("_reverse")).length()>0 && ((String)request.getParameter("_reverse")).equals("true") ){
                      reverse = true;
                    }
                    try {
                      res_Processador = com.egen.util.text.Sort.execute(res_Processador,((String)request.getParameter("_ordered")),reverse);
                    } catch (Exception e) {}
                  }
                  int processador_id =  0;
                  java.lang.String processador_nome =  null;
                  int i_bl_report_Processador = 0;
                  t_processador = (br.com.werp.suporte.dbobj.table.Processador)res_Processador.elementAt(i_bl_report_Processador);
                  processador_id = t_processador.getProcessador_id();
                  processador_nome = t_processador.getProcessador_nome()==null?"":t_processador.getProcessador_nome();
                  %>
                  <tr class="reportHeader" >
                    <td >
                      <span class="spamHeaderLabel" style="text-align:left;width:100%;">
                        Nome
                      </span>
                    </td>
                  </tr>
                  <%
                  while (i_bl_report_Processador<res_Processador.size()){
                    counterbl_report_Processador++;
                    String style="";
                    if (!((i_bl_report_Processador%2)!=0)) {
                      style="class=rowColor";
                    } else {
                      style="class=rowBlank";
                    }
                    %>
                    <tr <%= style %> id='TRbl_report_Processador<%=counterbl_report_Processador%>' >
                      <td class="reportcolumn"  >
                        <a href="javascript:setLov('<%= processador_id %>','<%= processador_nome %>')" target="_self" STYLE="cursor:hand">
                          <span class="spamColumnLabel" style="text-align:left;">
                            <%= processador_nome %>
                          </span>
                        </a>
                      </td>
                    </tr>
                    <%
                    if (++i_bl_report_Processador >= res_Processador.size()) {
                      break;
                    }
                    t_processador = (br.com.werp.suporte.dbobj.table.Processador)res_Processador.elementAt(i_bl_report_Processador);
                    processador_id = t_processador.getProcessador_id();
                    processador_nome = t_processador.getProcessador_nome()==null?"":t_processador.getProcessador_nome();
                  }
                }
              }
              %>
            </table>
            <script>
              function setLov(PROCESSADOR_ID,PROCESSADOR_NOME) {
                <% { String returnBlock = ((request.getParameter("returnBlock")!=null)?request.getParameter("returnBlock"):(String)session.getAttribute("returnBlock_bl_report_Processador"));
                if (returnBlock!=null && returnBlock.length()>0) {
                  session.setAttribute("returnBlock_bl_report_Processador",returnBlock);%>
                  returnBlock = <%= returnBlock %>;
                  <% } else { %>
                  returnBlock = 0;
                  <% } } %>
                  <% { String return0 = ((request.getParameter("return0")!=null)?request.getParameter("return0"):(String)session.getAttribute("return0_bl_report_Processador"));
                  if (return0!=null && return0.length()>0) {
                    session.setAttribute("return0_bl_report_Processador",return0);%>
                    if (opener.document.forms[returnBlock].<%= return0 %>!=null) { opener.document.forms[returnBlock].<%= return0 %>.value=PROCESSADOR_ID };
                    <% } else { %>
                    if (opener.document.forms[returnBlock].processador_id!=null) { opener.document.forms[returnBlock].processador_id.value=PROCESSADOR_ID };
                    <% } } %>
                    <% { String return1 = ((request.getParameter("return1")!=null)?request.getParameter("return1"):(String)session.getAttribute("return1_bl_report_Processador"));
                    if (return1!=null && return1.length()>0) {
                      session.setAttribute("return1_bl_report_Processador",return1);%>
                      if (opener.document.forms[returnBlock].<%= return1 %>!=null) { opener.document.forms[returnBlock].<%= return1 %>.value=PROCESSADOR_NOME };
                      <% } else { %>
                      if (opener.document.forms[returnBlock].processador_nome!=null) { opener.document.forms[returnBlock].processador_nome.value=PROCESSADOR_NOME };
                      <% } } %>
                      window.close();
                    }
                  </script>
                </form>
                <%
              }
              %>
              <table class="footerTable">
                <tr>
                  <td class="footerTd">
                    <bean:message key="div.print"/>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
        </table>
      </body>
    </center>
  </html>
